package com.expdatacloud.service.impl;

import com.alibaba.druid.sql.visitor.functions.If;
import com.expdatacloud.entity.InspectionPlanMgt;
import com.expdatacloud.mapper.InspectionPlanMgtMapper;
import com.expdatacloud.service.InspectionPlanMgtService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 检验项目方案管理表 服务实现类
 * </p>
 *
 * @author jie
 * @since 2019-11-14
 */
@Service
public class InspectionPlanMgtServiceImpl  implements InspectionPlanMgtService {

    @Autowired
    private InspectionPlanMgtMapper mapper;

    @Override
    public List<InspectionPlanMgt> list() {
        return mapper.list();
    }

    @Override
    public InspectionPlanMgt getByCheckCategory(String checkCategory) {
        return mapper.getByCheckCategory(checkCategory);
    }

    @Override
    public InspectionPlanMgt get(InspectionPlanMgt inspectionPlanMgt) {
        return mapper.get(inspectionPlanMgt);
    }

    @Override
    public String getCheckProjectKeyByCheckScenarioName(String checkScenarioName) {
        InspectionPlanMgt inspectionPlanMgt= new InspectionPlanMgt();
        inspectionPlanMgt.setCheckScenarioName(checkScenarioName);
        InspectionPlanMgt inspectionPlanMgt1 = mapper.get(inspectionPlanMgt);
        if (null != inspectionPlanMgt1){
            return inspectionPlanMgt1.getCheckProjectKey();
        }
        return null;
    }
}
